package cn.edu.tsinghua.mutimedia.map.audio;


import java.io.IOException;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import cn.edu.tsinghua.mutimedia.audio.extract.Extract;
import cn.edu.tsinghua.mutimedia.util.Conf;

public class AudioFeatherExtractMap extends Mapper<Text, Text, Text, LongWritable>{

    public void map(Text key, Text value, Context context
                    ) throws IOException, InterruptedException {
        try  
        {  
        	System.out.println("AudioFeatherExtractMap***************************value:"+key.toString());
        	Conf.copyToLocal(key.toString());
        	Path filePath=new Path(key.toString());
           	String[] strs={Conf.LOCAL_VIDEO_DIR+filePath.getName()};
           	System.out.println("AudioFeatherExtractMap***************************filePath.getName():"+filePath.getName());
        	Extract.extract(strs);
         }  
         catch (Exception e)  
         {  
             System.out.println("******************************Error in processing*******************************");  
         }  
         context.write(key, new LongWritable(0));  
     }  

}
